#include("../layout.html")
#@layout("媒体库")

#define body()
<h1 class="wp-heading-inline">媒体库</h1>
<a href="/admin/attachment/create" class="page-title-action">添加</a>
<hr class="wp-header-end">

<div class="layui-fluid">
	<h2 class="screen-reader-text">过滤媒体项目列表</h2>
	
	<form id="posts-filter" class="layui-form">
		<div class="wp-filter">
			<div class="filter-items">
				<input type="hidden" name="mode" value="list">
				<div class="view-switch">
					<a href="?mode=list" class="view-list current" id="view-switch-list"><span class="screen-reader-text">列表视图</span></a>
					<a href="?mode=grid" class="view-grid" id="view-switch-grid"><span class="screen-reader-text">网格视图</span></a>
				</div>
		
				<label for="attachment-filter" class="screen-reader-text">按类型筛选</label>
				<div class="layui-inline">
					<select class="attachment-filters" name="attachment-filter" id="attachment-filter">
						<option value="">所有多媒体项目</option>
						<option value="post_mime_type:image">图像</option>
						<option value="detached">尚未附加</option>
						<option value="mine">我的</option>
					</select>
				</div>
		
				<div class="actions">
					<label for="filter-by-date" class="screen-reader-text">按日期筛选</label>
					<div class="layui-inline">
						<select name="m" id="filter-by-date">
							<option selected="selected" value="0">全部日期</option>
							<option value="201903">2019年三月</option>
						</select>
					</div>
					<div class="layui-inline">
						<input type="submit" name="filter_action" id="post-query-submit" class="layui-btn layui-btn-sm layui-btn-primary" value="筛选">
					</div>		
				</div>
			</div>
		
			<div class="search-form">
				<label for="media-search-input" class="screen-reader-text">搜索媒体</label>
				<div class="layui-inline">
					<input type="search" placeholder="搜索媒体项目…" id="media-search-input" class="layui-input" name="s" value="">
				</div>
			</div>
		</div>
		
		<div class="tablenav top">
			<div class="alignleft actions bulkactions">
				<label for="bulk-action-selector-top" class="screen-reader-text">选择批量操作</label>
				<div class="layui-inline">
					<select name="action" id="bulk-action-selector-top">
						<option value="-1">批量操作</option>
						<option value="trash">永久删除</option>
					</select>
				</div>
				<div class="layui-inline">
					<input type="submit" id="doaction" class="layui-btn layui-btn-sm layui-btn-primary" value="应用">
				</div>
			</div>
			<div class="tablenav-pages"></div>
			<br class="layui-clear">
		</div>
		
		<h2 class="screen-reader-text">文章列表</h2>
		<table class="layui-table" lay-skin="line" lay-even>
		  	<colgroup>
		  		<col width="30">
		    	<col>
		    	<col width="120">
		    	<col width="180">
		    	<col width="60">
		    	<col width="150">
		  	</colgroup>
		  	<thead>
		    	<tr align="left">
		    		<th><input type="checkbox" name="" lay-skin="primary"></th>
		      		<th>文件</th>
		      		<th>作者</th>
		      		<th>上传至</th>
		      		<th><i class="layui-icon layui-icon-chat"></i></th>
		      		<th>日期</th>
		    	</tr> 
		  	</thead>
		  	<tbody>
		    	
		  	</tbody>
		  	#[[
		  		<script id="attachment-page-tpl" type="text/xml">
				{{# layui.each(d, function(index, item){ }}
				<tr align="left">
		    		<td><input type="checkbox" name="" lay-skin="primary"></td>
		      		<td>
		      			<strong class="has-media-icon">
							<a href="/admin/attachment/edit?post={{item.ID}}" aria-label="“ad”（编辑）">				
								<span class="media-icon image-icon">
									<img width="60" height="60" src="{{item.guid}}" class="attachment-60x60 size-60x60" alt="">
								</span>
								{{item.post_title}}
							</a>		
						</strong>
						<p class="filename">
							<span class="screen-reader-text">文件名： </span>
							{{item.filename}}
						</p>
		      			<div class="row-actions">
		      				<span class="edit"><a href="/admin/attachment/edit?post={{item.ID}}" aria-label="编辑“(无标题)”">编辑</a> | </span>
		      				<span class="trash"><a href="/admin/attachment/delete?post={{item.ID}}" class="submitdelete" aria-label="移动“(无标题)”到垃圾箱">永久删除</a> | </span>
		      				<span class="view"><a href="/{{item.post_name}}" rel="bookmark" aria-label="预览“(无标题)”">查看</a></span>
		      			</div>
		      		</td>
		      		<td>
		      			<a href="/admin/post?author={{item.author.ID}}">{{item.author.display_name}}</a>
		      		</td>
		      		<td>
		      			<span>—</span>
		      			<span class="screen-reader-text">没有标签</span>
					</td>
		      		<td>
		      			{{# if(0 == item.comments){ }}
		      			<span>—</span>
		      			<span class="screen-reader-text">无评论</span>
						{{# }else{ }}
						<a href="/admin/comment?post={{item.ID}}">{{item.comments}}</a>
						{{# } }}
		      		</td>
		      		<td>
		      			最后修改
		      			<br/>
		      			<abbr title="{{item.post_modified_gmt}}">{{item.post_modified_format}}</abbr>
		      		</td>
		    	</tr>				
				{{# }); }}
				</script>
		  	]]#
		  	<tfoot>
		    	<tr align="left">
		    		<th><input type="checkbox" name="" lay-skin="primary"></th>
		      		<th>标题</th>
		      		<th>作者</th>
		      		<th>标签</th>
		      		<th><i class="layui-icon layui-icon-chat"></i></th>
		      		<th>日期</th>
		    	</tr> 
		  	</tfoot>
		</table>
		
		<div class="tablenav bottom">
			<div class="alignleft actions bulkactions">
				<label for="bulk-action-selector-bottom" class="screen-reader-text">选择批量操作</label>
				<div class="layui-inline">
					<select name="action2" id="bulk-action-selector-bottom">
						<option value="-1">批量操作</option>
						<option value="trash">永久删除</option>
					</select>
				</div>
				<div class="layui-inline">
					<input type="submit" id="doaction2" class="layui-btn layui-btn-sm layui-btn-primary" value="应用">
				</div>
			</div>
			<div class="tablenav-pages"></div>
			<br class="layui-clear">
		</div>
	</form>
</div>
#end

#define foot()
<script>
layui.cache.page = 'attachment';
</script>
#end